#ifndef FUNCTION_H_BACK
#define FUNCTION_H_BACK

#include "func.h"

typedef struct{
    int size;
    char buf[1024];
    int dataLength;
}train_s;

typedef struct {     // 小火车，用于和客户端传送文件
    int length;         //文件大小
    char data[1000];         // 用于存放每次传输的数据
}train_t;

char* substring(char* str, int start, int end);
int epollDel(int fd, int epfd);
//int factoryInit(factory_t *pFactory, int threadNum);
//int handleEvent(int netFd, factory_t *pFactory);
int sendn(int fd, const void * buf, int len);
int setnonblocking(int fd);
int sysNote(char * buf);
//int taskDeQueue(taskQueue_t *pTaskQueue);
//int taskEnQueue(taskQueue_t *pTaskQueue, int netFd);
int tcpInit(char *ip, char *port, int *pSockFd);
//int transFile(int netFd);
void addfd(int epollfd, int fd, bool enable_et);
void cdFunction(int clientfd);
void cleanFunc(void *pArgs);
void getsFunction_bigfile(int clientfd,int filefd,off_t filesize,off_t filexistmark);
void getsFunction(int clientfd, char *filename, int epollfd);
//void getsFunction(int clientfd, char *filename, int epollfd,MYSQL * conn,char *username);
void getsFunction_smallfile(int clientfd,int filefd,off_t filesize);
//void lsFunction(int clientfd);
void lsFunction(int clientfd, MYSQL * conn, char * username);
//void mkdirFunction(int clientfd,char* buf);
void mkdirFunction(int clientfd,MYSQL* conn,char* username,char* buf);
void putsFunction_bigfile(int clientfd,int filefd,off_t filesize,off_t filexistmark);
void putsFunction(int clientfd, char *filename, int epollfd);
//void putsFunction(int clientfd, char *filename, int epollfd,MYSQL * conn,char *username);
void putsFunction_smallfile(int clientfd,int filefd,off_t filesize);
//void pwdFuction(int clientfd);
void pwdFunction(int clientfd);
//void rmFunction(int clientfd, char *buf);
void rmFunction(int clientfd, char *buf, MYSQL * conn);                       
void sigFunc(int signum);
void* threadFunc(void *pArgs);

#endif
